<template>
  <div class="exam-card" @click="onClick">
    <van-icon v-if="data.icon" class="exam-card__icon--prefix" :name="data.icon" />
    <span class="exam-card__title">{{ data.name }}</span>
    <van-icon name="arrow" />
  </div>
</template>

<script>
import { Icon } from 'vant'

export default {
  components: {
    [Icon.name]: Icon
  },
  props: {
    data: {
      type: Object,
      required: true
    }
  },
  methods: {
    onClick() {
      this.$emit('click')
    }
  }
}
</script>

<style lang="less">
.exam-card {
  background-color: #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: inset 0 -2px 0 0 #f5f5f5;
  height: 150px;
  padding: 0 40px;

  font-size: 36px;
  color: #333333;

  &__title {
    flex: 1;
    font-weight: 500;
  }

  &__icon--prefix ~ &__title {
    margin-left: 10px;
  }

  &__icon--prefix {
    color: @primary;
    font-size: 60px;
  }
}
</style>
